import os
import subprocess

#Set input and output folder pahts
input_folder = 'C:/Users/Tim/Documents/Python/Pablo_Code/Ethanol_Drinking/input_folder/'
output_folder = 'C:/Users/Tim/Documents/Python/Pablo_Code/Ethanol_Drinking/output_folder/'
udf_path = 'C:/Users/Tim/Documents/Python/UDFs'

#Collect list of file names for processing
input_files = []
for file_name in os.listdir(input_folder):
	input_files.append(file_name)
	
#Main processing loop
for file_name in input_files:
	input_handle = input_folder + file_name
	output_handle = output_folder + file_name
	print('Processing: ' + file_name + '...')
	subprocess.call(['python', 'ethanol_drinking_import.py', input_handle, output_handle, udf_path])
	subprocess.call(['python', 'ethanol_drinking_calc.py', udf_path, 'event_dict.pkl'])
	subprocess.call(['python', 'ethanol_drinking_output.py', udf_path, output_handle, 'event_dict.pkl', 'calc_dict.pkl'])

print('Done')
